package com.example.covid19.mapper;

import com.example.covid19.common.Dto.acgDto;
import com.example.covid19.common.Dto.monDto;
import com.example.covid19.entity.Achat;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author BaiZhengChun
 * @since 2022-12-03
 */
public interface AchatMapper extends BaseMapper<Achat> {
    @Select("SELECT " +
            " `user`.username,  " +
            " achat.ssid,  " +
            " achat.quantity,  " +
            " achat.lot,  " +
            " achat.prix,  " +
            " achat.tame,  " +
            " achat.numerotage,  " +
            " achat.fondateur,  " +
            " gstock.goodsname,  " +
            " avance.avaname " +
            " FROM " +
            " achat " +
            " INNER JOIN " +
            " gstock " +
            " ON  " +
            " achat.ssid = gstock.ssid " +
            " INNER JOIN " +
            " avance " +
            " ON  " +
            " achat.avance = avance.avaid, " +
            " `user` " +
            "WHERE " +
            " achat.fondateur = `user`.userid AND " +
            " achat.ssid = gstock.ssid")
    List<acgDto> acginfo();
    @Select("SELECT " +
            " `user`.username,  " +
            " achat.ssid,  " +
            " achat.quantity,  " +
            " achat.lot,  " +
            " achat.prix,  " +
            " achat.tame,  " +
            " achat.numerotage,  " +
            " achat.fondateur,  " +
            " gstock.goodsname " +
            "FROM " +
            " achat " +
            " INNER JOIN " +
            " gstock " +
            " ON  " +
            " achat.ssid = gstock.ssid " +
            " INNER JOIN " +
            " avance " +
            " ON  " +
            " achat.avance = avance.avaid, " +
            " `user`" +
            " WHERE " +
            " achat.fondateur = `user`.userid AND " +
            " achat.ssid = gstock.ssid ")
    List<acgDto> acginfo2(@Param("pageNo")Integer pageNo, @Param("pagesize")Integer pagesize);

}
